package lihao2;

public class Test8 {
    public static int[]  twoSum(int[] nums,int target){
        int n = nums.length;
        for (int i = 0; i < n; ++i) {//循环遍历的次数
            for (int j = i+1; j <n ; ++j) {//假设第一个是x,重新在数组中寻找target-x
                if(nums[i] + nums[j] == target){
                    System.out.println("i的下标为======"+i+",======j的下标为"+j);
                    return new int[]{i,j};

                }
            }
        }
        return new int[0];
    }

}
